/**
 * @param {string} arriveAlice
 * @param {string} leaveAlice
 * @param {string} arriveBob
 * @param {string} leaveBob
 * @return {number}
 */
 var countDaysTogether = function(arriveAlice, leaveAlice, arriveBob, leaveBob) {
  let month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  let prefixSum = [0]
  for(let i=0;i<month.length;i++){
    prefixSum.push(prefixSum[i]+month[i])
  }

  let aliceArriveDay = caculateDay(arriveAlice)
  let aliceLeaveDay = caculateDay(leaveAlice)
  let bobArriveDay = caculateDay(arriveBob)
  let bobLeaveDay = caculateDay(leaveBob)

  return Math.max(0,Math.min(aliceLeaveDay,bobLeaveDay)-Math.max(aliceArriveDay,bobArriveDay))

  function caculateDay(day){
    return prefixSum[parseInt(day.split('-')[0])-1]+parseInt(day.split('-')[1])
  }

};